package com.woniu.liuzhougov.systemSettings.service.impl;

import com.woniu.liuzhougov.systemSettings.dao.SxTypeMapper;
import com.woniu.liuzhougov.systemSettings.pojo.SxType;
import com.woniu.liuzhougov.systemSettings.service.SxTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Description: 事务类型管理服务实现层
 * @author: Tang
 * @createDate: 2019/4/19 0018
 * @version: 1.0
 */
@Service
public class SxTypeServiceImpl implements SxTypeService {

    @Resource
    private SxTypeMapper sxTypeMapper;

    @Override
    public List<SxType> selAll() {
        return sxTypeMapper.selectAll();
    }

    @Override
    public String insert(SxType sxType) {
        try {
            sxTypeMapper.insertSelective(sxType);
        }catch (Exception e){
            return "false";
        }
        return "success";

    }

    @Override
    public String update(SxType sxType) {
        try {
            sxTypeMapper.updateByPrimaryKey(sxType);
        }catch (Exception e){
            return "false";
        }
        return "success";
    }

    @Override
    public String delete(int itemTypeId) {
        try {
            sxTypeMapper.deleteByPrimaryKey(itemTypeId);
        }catch (Exception e){
            return "false";
        }
        return "success";
    }
}
